package com.neiquan.backstage.meeting_room.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neiquan.backstage.common.util.ExtraSpringHibernateTemplate;
import com.neiquan.backstage.meeting_order.MeetingOrderService;
import com.neiquan.backstage.meeting_room.MeetingRoomService;
import com.neiquan.backstage.pub.bsc.dao.po.MeetingOrder;
import com.neiquan.backstage.pub.bsc.dao.po.MeetingRoom;
/**
 * MeetingRoomService实现层
 * @author linjiang
 *
 */
@Service
public class MeetingRoomServiceImp implements MeetingRoomService {
	private static Class<?> poc = MeetingRoom.class;
	@Autowired
	private ExtraSpringHibernateTemplate extraSpringHibernateTemplate;

	@Override
	public MeetingRoom queryById(Integer id) {
		// TODO Auto-generated method stub
		return extraSpringHibernateTemplate.findFirstOneByPropEq(poc, "meetingRoomId", id);
	}

	@Override
	public List<MeetingRoom> queryByMemberId(Integer memberId) {
		// TODO Auto-generated method stub
		return extraSpringHibernateTemplate.findAllByPropEq(poc, "memberId", memberId);
	}

	@Override
	public MeetingRoom queryByName(Integer memberId, String name) {
		// TODO Auto-generated method stub
		List<MeetingRoom> listM=(List<MeetingRoom>) extraSpringHibernateTemplate.getHibernateTemplate().find("From MeetingRoom where memberId=? and name=?", memberId,name);
		if(listM.size()<=0){
			return null;
		}
		return listM.get(0);
	}
}
